Count the elements in a List until an element is a TupleΒΆ
if isinstance(t, tuple)
Count the elements in a List until an element is a Tuple.
LOT = [
10,
20,
30,
(10,20),
40
]
cnt = 0
for t in LOT:
if isinstance(t, tuple):
break
cnt += 1
print(cnt) # 3